package main

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

// main
//
//	@Description: gin 快速开始
func main() {
	//创建一个默认路由引擎
	engine := gin.Default()

	//配置路由, GET POST PUT DELETE
	engine.GET("/", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"message": "hello gin-two",
			"code":    200,
			"data":    nil,
		})
	})

	engine.GET("/get", func(c *gin.Context) {
		c.String(http.StatusOK, "%s", "get success")
	})

	engine.POST("/add", func(c *gin.Context) {
		c.String(200, "%s", "add success")
	})

	engine.PUT("/edit", func(c *gin.Context) {
		c.String(http.StatusOK, "%s", "edit success")
	})
	engine.DELETE("/del", func(c *gin.Context) {
		c.String(200, "%s", "del success")
	})

	//启动服务
	engine.Run("0.0.0.0:8811")

}
